package com.ht.temp.service.impl;

import com.ht.temp.entity.YearReport;
import com.ht.temp.mapper.YearReportMapper;
import com.ht.temp.service.IYearReportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author mayke_zhou
 * @since 2018-12-24
 */
@Service
@Transactional
public class YearReportServiceImpl extends ServiceImpl<YearReportMapper, YearReport> implements IYearReportService {
   @Autowired
    private   YearReportMapper yearReportMapper;


    @Override
    public int deleteByPrimaryKey(Integer yearId) {
        return yearReportMapper.deleteByPrimaryKey(yearId);
    }

    @Override
    public int insertSelective(YearReport record) {
        return yearReportMapper.insertSelective(record);
    }

    @Override
    public YearReport selectByPrimaryKey(Integer yearId) {
        return yearReportMapper.selectByPrimaryKey(yearId);
    }

    @Override
    public List<YearReport> getYearReportByYear(Integer deviceId, String startTime, String endTime) {
            System.out.println(startTime.substring(0,startTime.length()-9)+"/"+endTime.substring(0,startTime.length()-9));
            String sTime = startTime.substring(0,startTime.length()-9);
            String eTime = endTime.substring(0,startTime.length()-9);
            return yearReportMapper.selectYearReportByYear(sTime,eTime,deviceId);
    }

    @Override
    public List<YearReport> selectByYearReport(YearReport report) {
        return null;
    }

    @Override
    public List<YearReport> selectByMouthReport() {
        return null;
    }
}
